stage.set_background("schoolentrance")
sprite = codesters.Sprite("person10")
sprite.go_to(-125, -100)
emma = codesters.Sprite("person8")
emma.move_down(125)
emma.say("Someone took my phone!")
stage.wait(2)
emma.say("They've been sending people mean texts pretending to be me!")
stage.wait(2)
sprite.say("What should I do?")
stage.wait(2)
choice = sprite.ask("a) tell a trusted adult b) tell people Emma is sending the messages c) ignore Emma")
# text = codesters.Text("text", x, y)
text = codesters.Text("Hello up here.", 0, 200)
if choice == "a":
# add your code here
text.set_text("Great job!")
if choice == "b":
text.set_text("It's not nice to spread rumors")
if choice == "c":
text.set_text("Stand up to bullying")
t = codesters.Teacher()
try:
tval1 = emma.get_x()
except:
tval1 = "DNE"
try:
tval2 = stage.get_image_name()
except:
tval2 = "DNE"
#print tval2
t1 = TestObjective()
t1.add_success(tval1 == -500, "Great job!")
t1.add_failure(tval1 == 0, "Make sure you move your first sprite off the stage!")
t1.add_failure(tval1 == "DNE", "Did you delete the sprite named emma?")
t2 = TestObjective()
t2.add_success(tval2 == "schoolhallway", "Great job!")
t2.add_failure(tval2 == "DNE", "Did you delete the background image?")
t2.add_failure(tval2 == "schoolentrance", "Did you add a new background image?")
t2.add_creative(tval2 != "DNE" and tval2 != "schoolentrance" and tval2 != "schoolhallway", "That's a good background too!")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)